<template>
  <div class="my-header flexBetween">
    <div class="admin-name flexCenter">
      <el-space wrap>
        <el-avatar class="logo">HA</el-avatar>
        <span class="title">Apex</span>
      </el-space>
    </div>
    <div>
      <TabNar></TabNar>
    </div>
    <div>
      <el-popover placement="bottom" title="操作" :width="200" trigger="click" disabled>
        <template #reference>
          <el-avatar>{{user.substring(0,2)}}</el-avatar>
        </template>
        <template #default>
          <el-button type="primary" plain>退出</el-button>
        </template>
      </el-popover>
    </div>
  </div>
</template>

<script setup>
import TabNar from './TabNar.vue';
import { ref } from 'vue';

const user = ref('User');
const userInfo = localStorage.getItem('userInfo') || '{}';
user.value = JSON.parse(userInfo).user_name||'User';
</script>

<style lang="less" scoped>
.my-header {
  padding: 0 20px;
  height: 100%;
  .logo{
    background-color: #ffd04b;
  }
  .title{
    font-weight: bolder;
  }
  .img {
    width: 30px;
    height: 30px;
    background: var(--el-color-warning-light-5);
    border-radius: 50%;
  }
}</style>